package net.zkbc.akka;

import static net.zkbc.akka.SpringExtension.SpringExtProvider;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.typesafe.config.ConfigFactory;

import akka.actor.ActorSystem;

@Configuration
public class AkkaConfiguration {

	@Autowired
	private ApplicationContext applicationContext;

	@Bean
	public ActorSystem actorSystem() {
		ActorSystem actorSystem = ActorSystem.create("ClusterSystem", ConfigFactory.load());
		SpringExtProvider.get(actorSystem).initialize(applicationContext);
		return actorSystem;
	}

}
